<template>
	<view class="my h100">
		<view class="my-top">
			<view class="flex s-center">
				<image src="/static/img/my/portrait.png" class="portrait"></image>
				<view class="msg">
					<text class="txt">{{ userInfo.userNameCN }}</text>
				</view>
			</view>
		</view>
		<u-list height="600rpx" class="p-10">
			/* #ifdef APP-PLUS */
			<u-list-item>
				<u-cell icon="grid-fill" :title="`当前版本：${version}`" />
			</u-list-item>
			/* #endif */
			<u-list-item>
				<u-cell icon="server-man" title="意见反馈" isLink @click="handleClick" />
			</u-list-item>
		</u-list>
		<u-button @tap="logout()" class="logout" shape="circle"
			color="linear-gradient(83deg, #B8B9BF 1%, #B7BABF 99%)">退出登录</u-button>
	</view>
</template>

<script setup>
	import {
		getAuthorization
	} from '@/router/auth.js';

	// 基础变量
	const userInfo = uni.getStorageSync('userInfo'),
		version = uni.getSystemInfoSync().appWgtVersion;

	function logout() {
		uni.showModal({
			title: '提示',
			content: '确定要退出并清理缓存吗?',
			success(res) {
				if (res.confirm) {
					// #ifdef APP
					// 清空所有推送消息
					plus.push.clear();
					// #endif
					uni.clearStorage();
					uni.reLaunch({
						url: '/pages/login/login'
					});
				}
			}
		});
	};

	function handleClick() {
		uni.navigateTo({
			url: '/pages/my/insert'
		});
	}
</script>

<style lang="scss" scoped>
	.my {
		&-top {
			padding: calc(80rpx + var(--status-bar-height)) 40rpx 0;
			background: url('@/static/img/my/bg.png') no-repeat;
			background-size: 100% 100%;
			height: 300rpx;

			.portrait {
				width: 200rpx;
				height: 200rpx;
			}

			.msg {
				color: #ffffff;
				margin-left: 20rpx;

				.txt {
					font-size: 52rpx;
					position: relative;
				}

				.team {
					position: relative;
					padding-left: 30rpx;
				}
			}
		}

		.card {
			height: 600rpx;
		}

		.logout {
			width: 90%;
			border: 0.5px solid #cdcdcd;
			position: absolute;
			left: 5%;
			bottom: 3%;
		}
	}
</style>